DR='N:'
F1='DRUGS'
F2='DISPOS'
F3='PUR_DRUG'
F4='PUR_DISP'
F5='SUPPLIER'
F6='PUR_TEMP'
SELE 1
SET EXCLU OFF
use &DR&F1
SELE 2
SET EXCLU OFF
use &DR&F2
SELE 3
SET EXCLU OFF
USE &DR&F3
SELE 4
SET EXCLU OFF
USE &DR&F4
SELE 5
SET EXCLU OFF
USE &DR&F5 INDEX &DR&F5
SELE 1
go top
set colo to bg+/b,w+/n
@ 7, 1 CLEA TO 23,78
@  8,  5  SAY "ITEM REORDER"
@ 10,  2  SAY "CODE    DRUG,  DESCRIPTION AND PACKAGING        REFILL    ACTUAL    SUGGESTED"
@ 11, 50  SAY "LEVEL     LEVEL     RE-ORDER"
@ 16,  5  SAY "RE-ORDER (Y/N) :"
@  7,  3  TO  9, 18    DOUBLE
@ 12,  2  TO 12, 77
@ 10,  7  TO 14,  7
@ 10, 48  TO 14, 48
@ 10, 58  TO 14, 58
@ 10, 68  TO 14, 68
@ 15,  3  TO 17, 24    DOUBLE
lyyrx=savescreen(0,0,24,79)
OKK=.T.
NDT='N'
ord='y'
num=0
pric=0
qant=0
valu=0
disc=0
netpric=0
cdis=0
suppcod=space(4)
suppnam=space(24)
set colo to bg+/b,w+/n
UL='Y'
BACK='N'
*LOCATE FOR ST_ACT_BUY<=ST_REFIL .AND. .not. ST_REORDER .AND. ST_RE_PROP
LOCATE FOR .not. ST_REORDER .AND. ST_RE_PROP
DO WHILE .T.
   IF FOUND()
      AREA='1'
      KODE=DRUG_CODE
      NAME=DRUG_NAME
      UNIT=DRUG_UNIT
      TIPE=DRUG_TYPE
      QANT=DRUG_QANT
      BUYUNIT=BUY_UNIT
      DO PURC_A1
      IF BACK='Y'
         RETURN
      ENDIF
      if ord='Y'
         DO PURC_B
         IF OKK=.F.
            RETURN
         ELSE
            DO PURC_B1
         ENDIF
      endif
   ELSE
      @ 10,  9  SAY "DISPOSABLE, DESCRIPTION AND PACKAGING"
      SELE 2
*      LOCATE FOR ST_ACT_BUY<=ST_REFIL .AND. .not. ST_REORDER .AND. ST_RE_PROP
      LOCATE FOR .not. ST_REORDER .AND. ST_RE_PROP
      DO WHILE .T.
         IF FOUND()
            AREA='2'
            KODE=DISP_CODE
            NAME=DISP_NAME
            UNIT=DISP_UNIT
            TIPE=DISP_TYPE
            QANT=DISP_QANT
            BUYUNIT=BUY_UNIT
            DO PURC_A1
            IF BACK='Y'
               RETURN
            ENDIF
            if ord='Y'
               DO PURC_B
               IF OKK=.F.
                  RETURN
               ELSE
                  DO PURC_B1
               ENDIF
            endif
         ELSE
            set colo to gr+/r,w+/n
            @ 18,1 clear to 23,78
            @ 21,25  TO 23,53 DOUBLE
            ndt='Y'
            @ 20,23  SAY "NO MORE ITEMS BELOW RE-ORDER LEVEL"
            @ 22,27 say "Press any key to continue"

            set cons off
            WAIT
            set cons on
            exit
         ENDIF
         CONTINUE
      ENDDO
   ENDIF
   if ndt='Y'
      exit
   else
      sele 1
      CONTINUE
   endif
ENDDO
RETURN

